package cn.ali.myMultConnect;

/**
 * @className: DynamicDataSourceHolder
 * @author: zhfy
 * @date: 2019/4/15
 */
public class DynamicDataSourceHolder {
    private static final ThreadLocal<String> holder = new ThreadLocal<>();


    public static void putDataSource(String type) {
        holder.set(type);
    }

    public static String getDataSource() {
        String s = holder.get();
        return s == null ? "master" : s;
    }

    public static void clearDataSouce() {
        holder.remove();
    }

}
